package com.gz.spring.aop.proxy2;

import org.junit.jupiter.api.Test;

public class TestVehicle {

    @Test
    public void run(){
        Vehicle vehicle = new Ship();
        vehicle.run();
    }

    @Test
    public void runProxy(){
        Vehicle vehicle = new Ship();
        VehicleProxyProvider vehicleProxyProvider = new VehicleProxyProvider(vehicle);
        //这里的proxy编译类型是Vehicle
        //运行类型是 class com.sun.proxy.$Proxy9
        Vehicle proxy = vehicleProxyProvider.getProxy();
        System.out.println("proxy的运行类型是"+proxy.getClass());
        proxy.run();
    }
}
